var vue = new Vue({
    el: '#main',
    data() {
        return {
            //江宁地图的json数据
            data: [],
            //江宁地图网格的json数据
            gridData: [],
            //首次进入得到全部的数据
            firstPointData: {},
            //根据搜索关键字或者根据cate_id得到的数据
            secondPointData: 0,
            //首次进入的18个社区的数据
            firstCommunityData: [],
            //网格面的text
            gridTextArr: [],
            // 网格的text
            gridText: [],
            //部分数据
            pointData: {},

            //绘制有搜索条件地图push到数组里面
            arrayObj1: [],
            arrMarks1: [],
            //记录第一张图显示的label
            labelList: [],
            //记录第二张图显示的label
            labelList1: [],

            //记录一级社区的label
            communityLabel: [],
            //记录二级网格的label
            // grinLabel: [],
            //记录一级社区的label数据
            communityLabelData: [],
            //记录二级网格的label数据
            grinLabelData: [],

            //初始化的地图时加载的loading
            // mapLoading: true,
            //地图实例1
            map: null,
            //地图数据
            mapObj: {
                cate_id: '', //行业的id，餐饮为1
                dept_id: '', //
                grids_id: '', //
                keywords: '', //搜索关键字
                tags: "",
                second_cate_id: "",
            },
            second_cate_id_arr: [],
            mapobjtags: [],
            mapobjtagsname: [],
            //控制当地图缩放时不进行移动事件处理
            detail: {}, //点击坐标点的详情
            showDetail: false, //控制展示坐标详情的弹出框的显示
            showCommunitDetail: false, //控制展示社区详情的弹出框的显示
            communityTitle: '', //社区title
            communityDetail: {}, //社区详情
            //监听社区label是否已经绘制
            isDrawEightennmLabels: false,
            active: 1, //判断底部行业和网格高亮，1行业，2网格
            placeList: [], //底部行业的数据
            nineSmallList: [], //底部九小的数据
            isDown: false, //控制行业网格向上展开
            gridTotal: '', //底部网格数据的总数
            gridList: [], //底部网格的数据
            placeTotal: '', //底部场所总数
            ninePlaceTotal: '', //底部场所总数
            sonList: [], //
            time: null, //防止重复点击地图定位按钮，
            allBtnTime: null, //防止频繁点击地图全部按钮，
            marker1: null, //当点击定位会标记一个点，当第二次点击是应该清除第一个点
            isPlace9: false, //控制九小按钮的z-index层级
            isPlace9Sel: false, //控制九小按钮的z-index层级
            isModal: false, //控制列表按钮的z-index层级和列表框的实现
            categoryData: {}, //点击九小之后获取的数据
            categoryListData: [], //点击九小之后获取的数据
            place9Active: 1, //判断点击九小之后的高亮
            place9Data: [], //点击九小之后得到的数据
            //请求列表数据时使用
            placeObj: {
                page: 1,
                cate_id: '',
                keywords: '',
                dept_id: '',
                second_cate_id: ""
            },
            gridList: [], //
            communityList: [], //
            sonPlaceList: [], //场所列表数据
            isKeywords: false, //控制是否显示无搜索数据
            listActive: 1, //
            //记录当前zoom和中心点
            currentZoom: '',
            currentCenter: [],
            isManual: false, //场所位置弹窗
            mapma: null, //场所位置弹窗地图实例
            markerma: null, //场所位置弹窗marker
            isShowSearchTag: false, //搜索标签的显示
            color: [
                "#FF7301",
                "#FF5041",
                "#4CC85B",
                "#1B90FF",
                "#2EB9AA",
                "#CFAE5D",
                "#932EFF",
                "#49C658",
                "#FFB62B",
                "#668AFF",
                "#62AFF6",
                "#644299",
                "#644299",
                "#D09154",
                "#4FBD5C",
                "#F74033",
                "#3D69FF",
            ],
            color1: [
                "#FE7502",
                "#FF4B3D",
                "#1249FF",
                "#229CF1",
                "#912AFF",
                "#912AFF",
                "#2EB8AA",
                "#1C90FF",
                "#FFB425",
                "#FE8F74",
                "#FF5B36",
                "#62AFF6",
                "#75BA39",
                "#2573FE",
                "#D1AE5D",
            ],
            // 监控有关的数据
            player: null, //监控数据
            hls: null,
            isShowVideo: false, //是否显示监控的dia
            isLoading: false, //是否显示监控画面的loading
            monitorDetail: {}, //监控详情
            isShowTYVideo: false, //是否显示监控的dia
            isShowTYVideoLoading: false, //是否显示监控的dia
            TYtimer: null, //天翼监控定时器
            TYUrl: '', //天翼监控的url

            type: '', //监控类型
            num: '', //监控计时器
            numtimer: null, //监控计时器
            nearMonitorMarkers: [], //附近监控的marker
            nearMonitorlabels: [], //附近监控监控的Label
            nearMonitorList: [],
            //所有的地点push到数组里面
            arrayObj: [],
            arrMarks: [],

            // 不同级别的点位
            mapPointsMarkers12: [], // 第一级别的marker
            mapPointsLabels12: [], // Label
            mapPointsMarkers13: [], // 第一级别的marker
            mapPointsLabels13: [], // 监控的Label
            mapPointsMarkers14: [], // 第一级别的marker
            mapPointsLabels14: [], // 的Label
            mapPointsMarkers15: [], // 第15级别的marker
            mapPointsLabels15: [], // 的Label
            mapPointsMarkers16: [], // 第16级别的marker
            mapPointsLabels16: [], // 的Label
            mapPointsMarkers17: [], // 第17级别的marker
            mapPointsLabels17: [], // 的Label
            mapPointsMarkers18: [], // 第18级别的marker
            mapPointsLabels18: [], // 监控的Label
            mapPointsMarkers19: [], // 第12级别的marker
            mapPointsLabels19: [], // 的Label
            mapPointsMarkers20: [], // 第13级别的marker
            mapPointsLabels20: [], // 的Label
            mapPointsMarkers21: [], // 第14级别的marker
            mapPointsLabels21: [], // 的Label
            mapPointsArr12: [], // id集合
            mapPointsArr13: [],
            mapPointsArr14: [],
            mapPointsArr15: [],
            mapPointsArr16: [],
            mapPointsArr17: [],
            mapPointsArr18: [],
            mapPointsArr19: [],
            mapPointsArr20: [],
            mapPointsArr21: [],
        }
    },
    created() {
        this.getPlaceList()
        this.getGridList()
        this.showPlace9()
        this.getNinePlaceList()
    },
    mounted() {
        this.downHeight()
        setTimeout(() => {
            this.initMap()
        }, 700)
        window.addEventListener('scroll', this.onScroll, true)
    },
    destroy() {
        if (this.TYtimer) {
            clearTimeout(this.TYtimer)
            this.TYtimer = null
        }
    },
    watch: {},
    methods: {
        //初始化地图
        initMap() {
            wx.getLocation({
                isHighAccuracy: true,
                type: 'gcj02', // 默认为wgs84的 gps 坐标，如果要返回直接给 openLocation 用的火星坐标，可传入'gcj02'
                complete: (res) => {
                    let location1 = []
                    this.data = $.parseJSON($.ajax({
                        url: "../tangshan1.json", //json文件位置，文件名
                        dataType: "json", //返回数据格式为json
                        async: false
                    }).responseText);
                    this.gridData = $.parseJSON($.ajax({
                        url: "../tangshanwg.json", //json文件位置，文件名
                        dataType: "json", //返回数据格式为json
                        async: false
                    }).responseText);

                    if (res.errMsg == "getLocation:ok") {
                        location1.push(res.longitude, res.latitude)
                        location1 = gcj02ToWgs(res.longitude, res.latitude)
                        let cunLocation = []
                        cunLocation = gcj02ToWgs(res.longitude, res.latitude)
                        localStorage.setItem("location", cunLocation)
                        let kilometre = this.GetDistance(32.041969538363645, 119.0146777948411,
                            res.latitude, res.longitude)
                        if (kilometre > 10) {
                            location1 = [119.0146777948411, 32.041969538363645]
                        }
                    } else {
                        location1 = [119.0146777948411, 32.041969538363645]
                    }
                    location1.push(res.longitude, res.latitude)
                    //初始化地图对象
                    this.map = new T.Map("container");

                    //设置显示地图的中心点和级别
                    this.map.centerAndZoom(new T.LngLat(location1[0], location1[1]), 11);
                    this.map.setMinZoom(11);
                    this.map.setMaxZoom(22);
                    var tile = new T.TileLayer(
                        "http://t4.tianditu.gov.cn/DataServer?T=vec_w&x={x}&y={y}&l={z}&tk=73d0f6493f34241ea329fce72bce0a69"
                    );
                    this.map.addLayer(tile)
                    // //创建面对象
                    var polygon = new T.Polygon(this.data, {
                        color: "#1791fc",
                        weight: 3,
                        opacity: 0.9,
                        fillColor: "#1791fc",
                        fillOpacity: 0.05
                    });
                    //向地图上添加面
                    this.map.addOverLay(polygon);
                    this.getFirstEnterPoints()
                    this.map.addEventListener("moveend", this.listenerZoomOrMove)
                },
            })
        },
        //监听地图移动和放大缩小事件
        listenerZoomOrMove() {
            this.currentZoom = this.map.getZoom()
            console.log(this.currentZoom);
            if (this.currentZoom < 13) {
                //展示第一级别label
                this.communityLabel.forEach(item => {
                    this.map.addOverLay(item)
                })
                // 清空监控
                this.removePoints(this.nearMonitorMarkers)
                this.removePoints(this.nearMonitorlabels)
                this.nearMonitorMarkers = [] //附近监控的marker
                this.nearMonitorlabels = []
                // 清空其余各级别点位
                for (let i = 12; i <= 21; i++) {
                    this.removePoints(this['mapPointsMarkers' + i])
                    this.removePoints(this['mapPointsLabels' + i])
                    this['mapPointsMarkers' + i] = []
                    this['mapPointsLabels' + i] = []
                    this['mapPointsArr' + i] = []
                }
            } else {
                this.removePoints(this.communityLabel)
                //不用根据经纬度来进行绘制，直接根据级别来绘制并移除不对应的点位
                let _zoom = Math.floor(this.currentZoom)
                _zoom = _zoom > 21 ? 20 : _zoom

                // 移除级别高的
                for (let i = _zoom + 1; i <= 21; i++) {
                    this.removePoints(this['mapPointsMarkers' + i])
                    this.removePoints(this['mapPointsLabels' + i])
                    this['mapPointsMarkers' + i] = []
                    this['mapPointsLabels' + i] = []
                    this['mapPointsArr' + i] = []
                }
                // 绘制级别低的
                for (let i = 13; i <= _zoom; i++) {
                    this.drawPoints(i)
                }
            }
        },
        //首次进入获取全部的数据个坐标点
        getFirstEnterPoints() {
            ajax({
                // url: formal + '/place/get-agr-map-place',
                url: formal + '/place/get-map-place-list',
                type: 'GET',
                success: (res) => {
                    this.secondPointData = 0
                    this.firstPointData = res.data.list
                    this.communityLabelData = res.data.community_data
                    this.communityLabel.forEach(item => {
                        this.map.removeOverLay(item)
                    })
                    this.communityLabel = []
                    for (let i = 0; i < res.data.community_data.length; i++) {
                        if (res.data.community_data[i].place_num !== 0) {
                            let point = new T.LngLat(res.data.community_data[i].location[0], res
                                .data.community_data[i].location[1]);
                            var label = new T.Label({
                                text: `<div class="ub-firstPoint"><span class="ub-firstPoint1">${res.data.community_data[i].name}</span><span  class="ub-firstPoint2">${res.data.community_data[i].place_num}</span></div>`,
                                position: point,
                                offset: new T.Point(-25, -25),
                                id: res.data.community_data[i].id
                            })
                            label.addEventListener('click', async (e) => {
                                zoom = this.map.getZoom()
                                this.mapObj.dept_id = e.target.options.id
                                await this.getHandleMapLabelData()
                                this.map.centerAndZoom(e.target.options.position, zoom + 1)
                            })
                            this.communityLabel.push(label)
                        }

                    }
                    //只展示1级社区
                    this.communityLabel.forEach(item => {
                        this.map.addOverLay(item)
                    })
                }
            })
        },
        //获取点击第一级别label所有坐标点位
        getHandleMapLabelData() {
            ajax({
                // url: formal + '/place/get-agr-map-place',
                url: formal + '/place/get-map-place-list',
                type: 'GET',
                async: false,
                data: this.mapObj,
                success: (res) => {
                    let list = res.data.list
                    // let _list = [...list.map_level_12, ...list.map_level_13, ...list.map_level_14, ...list.map_level_15, ...list.map_level_16, ...list.map_level_17, ...list.map_level_18, ...list.map_level_19, ...list.map_level_20, ...list.map_level_21]
                    // list.map_level_12 = _list.splice(0, 2)
                    // list.map_level_13 = _list.splice(0, 6)
                    // list.map_level_14 = _list.splice(0, 8)
                    // list.map_level_15 = _list.splice(0, 12)
                    // list.map_level_16 = _list.splice(0, 24)
                    // list.map_level_17 = _list.splice(0, 36)
                    // list.map_level_18 = _list.splice(0, 48)
                    // list.map_level_19 = _list.splice(0, 56)
                    // list.map_level_20 = _list.splice(0, 128)
                    // list.map_level_21 = _list
                    this.secondPointData = 1
                    this.firstPointData = list
                    this.communityLabelData = res.data.community_select
                    //得到数据先清空
                    this.communityLabel.forEach(item => {
                        this.map.removeOverLay(item)
                    })
                    this.arrayObj1.forEach(item => {
                        this.map.removeOverLay(item)
                    })
                    this.communityLabel = []
                    for (let i = 0; i < res.data.community_select.length; i++) {
                        if (res.data.community_select[i].place_num !== 0) {
                            let point = new T.LngLat(res.data.community_select[i].location[0], res
                                .data.community_select[i].location[1]);
                            var label = new T.Label({
                                text: `<div class="ub-firstPoint"><span class="ub-firstPoint1">${res.data.community_select[i].name}</span><span  class="ub-firstPoint2">${res.data.community_select[i].place_num}</span></div>`,
                                position: point,
                                offset: new T.Point(-25, -25),
                                id: res.data.community_select[i].id
                            })
                            label.addEventListener('click', async (e) => {
                                zoom = this.map.getZoom()
                                this.mapObj.dept_id = e.target.options.id
                                await this.getHandleMapLabelData()
                                this.map.centerAndZoom(e.target.options.position, zoom + 1)
                            })
                            this.communityLabel.push(label)
                        }
                    }
                    //只展示1级社区
                    this.communityLabel.forEach(item => {
                        this.map.addOverLay(item)
                    })
                }
            })
        },
        //获取有条件所有坐标点位
        getMapPoints(color) {
            ajax({
                // url: formal + '/place/get-agr-map-place',
                url: formal + '/place/get-map-place-list',
                type: 'GET',
                async: false,
                data: this.mapObj,
                success: (res) => {
                    let list = res.data.list
                    // let _list = [...list.map_level_12, ...list.map_level_13, ...list.map_level_14, ...list.map_level_15, ...list.map_level_16, ...list.map_level_17, ...list.map_level_18, ...list.map_level_19, ...list.map_level_20, ...list.map_level_21]
                    // list.map_level_12 = _list.splice(0, 2)
                    // list.map_level_13 = _list.splice(0, 6)
                    // list.map_level_14 = _list.splice(0, 8)
                    // list.map_level_15 = _list.splice(0, 12)
                    // list.map_level_16 = _list.splice(0, 24)
                    // list.map_level_17 = _list.splice(0, 36)
                    // list.map_level_18 = _list.splice(0, 48)
                    // list.map_level_19 = _list.splice(0, 56)
                    // list.map_level_20 = _list.splice(0, 128)
                    // list.map_level_21 = _list
                    this.secondPointData = 1
                    this.firstPointData = list
                    this.communityLabelData = res.data.community_data
                    //得到数据先清空
                    this.communityLabel.forEach(item => {
                        this.map.removeOverLay(item)
                    })
                    this.arrayObj1.forEach(item => {
                        this.map.removeOverLay(item)
                    })
                    this.communityLabel = []
                    for (let i = 0; i < res.data.community_data.length; i++) {
                        if (res.data.community_data[i].place_num !== 0) {
                            let point = new T.LngLat(res.data.community_data[i].location[0], res
                                .data.community_data[i].location[1]);
                            var label = new T.Label({
                                text: `<div class="ub-firstPoint" style="background:${color}"><span
												class="ub-firstPoint1">${res.data.community_data[i].name}</span><span
												class="ub-firstPoint2">${res.data.community_data[i].place_num}</span></div>`,
                                position: point,
                                offset: new T.Point(-25, -25),
                                id: res.data.community_data[i].id
                            })
                            label.addEventListener('click', async (e) => {
                                zoom = this.map.getZoom()
                                this.mapObj.dept_id = e.target.options.id
                                await this.getHandleMapLabelData()
                                this.map.centerAndZoom(e.target.options.position, zoom + 1)
                            })
                            this.communityLabel.push(label)
                        }

                    }
                    //只展示1级社区
                    this.communityLabel.forEach(item => {
                        this.map.addOverLay(item)
                    })
                    // this.grinLabelData = res.data.grids_data
                    // this.grinLabel.forEach(item => {
                    //     this.map.removeOverLay(item)
                    // })
                    // this.grinLabel = []
                    // for (let i = 0; i < res.data.grids_data.length; i++) {
                    //     if (res.data.grids_data[i].place_num != 0) {
                    //         let point = new T.LngLat(res.data.grids_data[i].location[0], res.data
                    //             .grids_data[i].location[1]);
                    //         var label = new T.Label({
                    //             text: `<div class="ub-firstPoint0" style="background:${color}"><span
                    // 							class="ub-firstPoint1">${res.data.grids_data[i].name}</span><span
                    // 							class="ub-firstPoint2">${res.data.grids_data[i].place_num}</span></div>`,
                    //             position: point,
                    //             offset: new T.Point(-25, -25),
                    //             id: res.data.grids_data[i].id
                    //         })
                    //         label.addEventListener('click', async (e) => {
                    //             this.mapObj.grids_id = e.target.options.id
                    //             this.mapObj.dept_id = ''
                    //             await this.getHandleMapLabelData()
                    //             this.map.centerAndZoom(e.target.options.position, 17)
                    //         })
                    //         this.grinLabel.push(label)
                    //     }
                    // }
                }
            })
        },
        // 场所列表
        getSonPlaceList(page) {
            if (page == undefined) {
                page = 1
            }
            if (page == 1) {
                this.flag = false
            }
            this.placeObj.page = page
            this.placeObj.keywords = this.mapObj.keywords
            ajax({
                url: formal + '/place/get-grids-place',
                type: 'GET',
                data: this.placeObj,
                success: (res) => {
                    if (res.data.list.length == 0) {
                        this.total = res.data.total
                        this.flag = true
                    } else {
                        if (page > 1) {
                            this.sonPlaceList = this.sonPlaceList.concat(res.data.list)
                            this.arrRemoval(this.sonPlaceList)
                            this.total = res.data.total
                        } else {
                            this.sonPlaceList = res.data.list
                            this.total = res.data.total
                        }
                    }
                    this.cateName = res.data.cate_name
                }
            })
        },
        // 社区接口，列表展示，判断是否有搜索条件，调不同接口
        getCommunity(type) {
            let url = formal + '/place/get-grids'
            if (this.mapObj.keywords) {
                url = formal + '/place/get-place-community'
            }
            if (type == 1 && this.active == 2) {
                this.placeObj.cate_id = ''
            }
            ajax({
                url: url,
                type: 'GET',
                data: {
                    cate_id: this.placeObj.cate_id,
                    keywords: this.mapObj.keywords
                },
                success: (res) => {
                    this.communityList = res.data.list
                    res.data.list.map(item => {
                        item.flag = false
                    })
                    let tempList = []
                    this.gridList.map(item1 => {
                        this.communityList.map((item, index1) => {
                            if (item1.flag1 == true) {
                                if (item1.dept_id == item.dept_id) {
                                    item.flag = true
                                    tempList.push(item)
                                    this.placeObj.dept_id = item.dept_id
                                    this.getSonPlaceList()
                                }
                                this.communityList = tempList
                            }
                            if (this.mapObj.keywords) {
                                if (item.count == 0) {
                                    this.communityList.splice(index1, 1)
                                }
                            }
                        })
                    })
                }
            })
        },
        //获取行业下分类
        getPlaceList() {
            ajax({
                url: formal + '/place/category',
                type: 'GET',
                success: (res) => {
                    let newItem = {}
                    res.data.list.map(item => {
                        newItem = item
                        newItem.flag = false
                    })
                    this.placeList = res.data.list
                }
            })
        },
        // 网格下社区
        getGridList() {
            ajax({
                url: formal + '/place/get-grids',
                type: 'GET',
                success: (res) => {
                    let newItem = {}
                    res.data.list.map(item => {
                        newItem = item
                        newItem.flag = false
                        newItem.flag1 = false
                    })
                    this.gridTotal = res.data.total
                    this.gridList = res.data.list
                    this.placeTotal = res.data.place_total
                }
            })
        },
        // 获取底部tab九小的数据
        getNinePlaceList() {
            ajax({
                url: formal + '/place/little-category',
                type: 'GET',
                success: (res) => {
                    let newItem = {}
                    res.data.list.map(item => {
                        newItem = item
                        newItem.flag = false
                    })
                    this.nineSmallList = res.data.list
                    this.ninePlaceTotal = res.data.total
                }
            })
        },
        // 行业下分类是否是九小场所
        getPlaceList1(type) {
            if (type) {
                this.mapObj.dept_id = ''
            }
            ajax({
                url: formal + '/place/category',
                type: 'GET',
                data: {
                    is_small_place: type,
                    dept_id: this.mapObj.dept_id,
                },
                success: (res) => {
                    this.categoryData = res.data.list
                }
            })
        },
        // 网格下社区是否是九小场所
        getGridList1(type) {
            ajax({
                url: formal + '/place/get-grids',
                type: 'GET',
                data: {
                    is_small_place: type
                },
                success: (res) => {
                    let newItem = {}
                    res.data.list.map(item => {
                        newItem = item
                        newItem.flag = false
                        newItem.flag1 = false
                    })
                    this.place9Data = res.data.list
                }
            })
        },
        //获取点击坐标点获取详情及附近监控点位
        getPointDetail(id) {
            ajax({
                url: formal + '/place/place-info',
                type: 'GET',
                data: {
                    id: id
                },
                success: (res) => {
                    this.detail = res.data
                    if (res.data != undefined) {
                        this.isModal = false
                        this.showDetail = true
                        this.getNearMonitor(this.detail.id)
                    }
                }
            })
        },
        // 获取附近监控点位
        getNearMonitor(id) {
            ajax({
                url: formal + '/place/monitoring-scope?id=' + id,
                type: 'GET',
                success: (res) => {
                    this.nearMonitorList = res
                }
            })
        },
        // 点击社区查询列表，展示社区下场所数量
        communityBtn(item) {
            this.placeList.map(item => {
                item.flag = false
            })

            this.nineSmallList.map(item => {
                item.flag = false
            })
            this.mapObj.cate_id = ''
            this.mapObj.second_cate_id = ''
            this.gridList.map(item1 => {
                if (item.dept_id == item1.dept_id) {
                    item1.flag1 = !item1.flag1
                    if (item1.flag1 == true) {
                        this.mapObj.dept_id = item.dept_id
                        this.mapObj.level = ''
                        this.getHandleMapLabelData()
                    } else {
                        this.mapObj.dept_id = ''
                        this.mapObj.level = ''
                        this.getMapPoints()
                    }
                } else {
                    item1.flag1 = false
                }
            })
        },
        //点击搜索按钮进行搜索
        inputBtn() {
            this.isShowSearchTag = false
            if (this.mapObj.cate_id !== '' && this.placeObj.cate_id !== '') {
                this.placeObj.page = 1
                this.placeObj.keywords = this.mapObj.keywords
                this.getSonPlaceList()
            }
            this.map.centerAndZoom(new T.LngLat(119.0146777948411, 32.041969538363645), 11);
            this.getMapPoints()
        },
        handleSearchTag(val, name, type) {
            if (type == 1) {
                this.isPlace9 = false
                this.mapobjtags = []
                this.mapobjtagsname = []
                this.mapobjtags.push(val)
                this.mapobjtagsname.push(name)
                this.mapObj.tags = this.mapobjtags.join(',')
                if (this.mapObj.cate_id !== '' && this.placeObj.cate_id !== '') {
                    this.placeObj.page = 1
                    this.placeObj.keywords = this.mapObj.keywords
                    this.getSonPlaceList()
                }
                this.map.centerAndZoom(new T.LngLat(119.0146777948411, 32.041969538363645), 11);
                this.getMapPoints()
                return;
            }
            this.isPlace9 = false
            const index = this.mapobjtags.indexOf(val)
            if (index == -1) {
                this.mapobjtags.push(val)
                this.mapobjtagsname.push(name)
            } else {
                this.mapobjtags.splice(index, 1)
                this.mapobjtagsname.splice(index, 1)
            }
            this.mapObj.tags = this.mapobjtags.join(',')
            this.$refs.inputRef.focus()
        },
        // 经纬度转长度距离（单位米）
        GetDistance(lat1, lng1, lat2, lng2) {
            var radLat1 = lat1 * Math.PI / 180.0;
            var radLat2 = lat2 * Math.PI / 180.0;
            var a = radLat1 - radLat2;
            var b = lng1 * Math.PI / 180.0 - lng2 * Math.PI / 180.0;
            var s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2) +
                Math.cos(radLat1) * Math.cos(radLat2) * Math.pow(Math.sin(b / 2), 2)));
            s = s * 6378.137; // EARTH_RADIUS;
            s = Math.round(s * 10000) / 10000; //输出为公里
            return s; //此时返回的是米
        },
        // 根据缩放层级移除点标注
        removeAmarker(list, level) {
            if (level != undefined) {
                if (list.length > 0) {
                    if (list[0].length > 0) {
                        list[0].forEach(item => {
                            this.map.removeOverLay(item)
                        })
                    }
                    if (list[1].length > 0) {
                        list[1].forEach(item => {
                            this.map.removeOverLay(item)
                        })
                    }
                }

            } else {
                list.forEach(item => {
                    if (item.length == 0) {
                        this.map.clearOverLays();
                    } else {
                        item.forEach(item1 => {
                            this.map.clearOverLays(item)
                        })
                    }
                })
            }
        },
        // 预览图片
        lookImg(list) {
            //微信方式预览图片
            wx.previewImage({
                urls: list // 需要预览的图片 http 链接列表
            });
        },
        // 控制行业，网格高度
        downHeight() {
            this.isDown = !this.isDown
            let footerH = $('.ub-footerNav')[0].clientHeight
            let clHeight = document.body.clientHeight - footerH - 120
            let pullHeight = document.body.clientHeight - footerH - 115
            if (this.isDown) {
                document.getElementById('ub-drow').style.height = clHeight + 'px'
                // setTimeout(() => {
                // 	document.getElementsByClassName('ub-onPull')[0].style.top = pullHeight + 'px'
                // }, 200)
            } else {
                document.getElementById('ub-drow').style.height = '52%'
                // document.getElementsByClassName('ub-onPull')[0].style.top = '53%'
            }
        },
        // 行业下列表查看or收起
        unwindBtn(id) {
            this.gridList.map(item => {
                if (id == item.dept_id) {
                    this.sonList = item.place
                    item.flag = !item.flag
                } else {
                    item.flag = false
                }
            })
        },
        //点击地图上的定位左边回到当前位置
        goCurrent() {
            if (this.time) {
                clearTimeout(this.time)
            }
            this.time = setTimeout(() => {
                if (this.marker1) {
                    this.map.removeOverLay(this.marker1);
                    this.map1.removeOverLay(this.marker1);
                    this.map2.removeOverLay(this.marker1);
                    this.marker1 = null
                }
                wx.getLocation({
                    isHighAccuracy: true,
                    type: 'gcj02', // 默认为wgs84的 gps 坐标，如果要返回直接给 openLocation 用的火星坐标，可传入'gcj02'
                    complete: (res) => {
                        let currentData = gcj02ToWgs(res.longitude, res.latitude)
                        //设置显示地图的中心点和级别
                        //创建图片对象
                        var icon = new T.Icon({
                            iconUrl: "./images/coordinates.png",
                            iconSize: new T.Point(20, 20),
                            iconAnchor: new T.Point(10, 25)
                        });
                        //向地图上添加自定义标注
                        this.marker1 = null
                        this.marker1 = new T.Marker(new T.LngLat(currentData[0],
                            currentData[1]), {
                            icon: icon
                        });
                        this.map.addOverLay(this.marker1);
                        this.map.centerAndZoom(new T.LngLat(currentData[0],
                            currentData[1]), 18);

                    },
                });
            }, 500)
        },
        //点击全部按钮
        allBtn() {
            this.map.centerAndZoom(new T.LngLat(119.0146777948411, 32.041969538363645), 11);
            if (!(this.mapObj.cate_id || this.mapObj.keywords || this.mapObj.tags || this.isShowSearchTag || this.secondPointData !== 0)) {
                return;
            };
            this.allBtnTime = 1
            this.mapobjtags = []
            this.mapobjtagsname = []
            this.isShowSearchTag = false
            this.mapObj = {
                level: 1, //地图放大等级
                cate_id: '', //行业的id，餐饮为1
                dept_id: '', //
                grids_id: '', //
                keywords: '', //搜索关键字
                tags: "",
                second_cate_id: "",
            }
            this.placeObj = {
                page: 1,
                cate_id: '',
                keywords: '',
                dept_id: ''
            }
            this.placeList.map(item => {
                item.flag = false
            })
            this.nineSmallList.map(item => {
                item.flag = false
            })
            this.active = 1
            this.place9Active = 1
            this.listActive = 1
            this.currentZoom = 11
            this.showMap = 1
            this.secondPointData = []
            this.getFirstEnterPoints()
        },
        //点击九小按钮
        showPlace9() {
            ajax({
                url: formal + '/place/tags',
                type: 'GET',
                success: (res) => {
                    this.categoryListData = res.data.list
                }
            })
        },
        handleShowPlace9() {
            this.isPlace9 = true
            ajax({
                url: formal + '/place/tags',
                type: 'GET',
                success: (res) => {
                    this.categoryListData = res.data.list
                }
            })
        },
        //点击切换点击九小之后的高亮
        ListBtn() {
            this.placeObj.page = 1
            this.isModal = !this.isModal
            if (this.mapObj.keywords == '') {
                if (this.active == 1) {
                    if (this.mapObj.dept_id == '') {
                        this.sonPlaceList = []
                        if (this.isModal == true) {
                            this.getCommunity()
                        }
                        this.listActive = 1
                    } else {
                        if (this.isModal == true) {
                            this.getPlaceList1()
                        }
                        this.listActive = 2
                    }
                } else {
                    if (this.mapObj.cate_id == '') {
                        if (this.isModal == true) {
                            this.getPlaceList1()
                        }
                        this.listActive = 2
                    } else {
                        if (this.isModal == true) {
                            this.getCommunity()
                        }
                        this.listActive = 1
                    }
                }
            } else {
                this.sonPlaceList = []
                this.getCommunity(1)
            }

        },
        // 列表按钮
        //搜索后点击列表并且有数据时跳转
        getSonPlace(id, index) {
            this.communityList.map((item, index1) => {
                if (index == index1) {
                    item.flag = !item.flag
                    this.placeObj.dept_id = id
                    if (item.flag == true) {
                        this.getSonPlaceList()
                    }
                } else {
                    item.flag = false
                }
                this.$forceUpdate()
            })
        },
        // 跳转到列表查看页面
        goPlaceList(id) {
            window.location.href = "placeList.html?id=" + id + '&type=' + 2
        },
        // 数组去重
        arrRemoval(arr) {
            let obj = {}
            this.sonPlaceList = arr.reduce((preVal, curVal) => {
                obj[curVal.id] ? "" : obj[curVal.id] = preVal.push(curVal)
                return preVal
            }, [])
        },
        // 滚动条触底事件
        onScroll(e) {
            // if (this.flag === true) {
            // 	return
            // }
            if (this.isModal == false) {
                return
            }
            //变量scrollTop是滚动条滚动时，距离顶部的距离
            var scrollTop = document.getElementById('ub-scroll').scrollTop;
            //变量windowHeight是可视区的高度
            var windowHeight = document.getElementById('ub-scroll').clientHeight;
            //变量scrollHeight是滚动条的总高度
            var scrollHeight = document.getElementById('ub-scroll').scrollHeight;
            //滚动条到底部的条件
            let page = 1
            if (scrollTop + windowHeight == scrollHeight) {
                //写后台加载数据的函数
                page = ++this.placeObj.page
                this.getSonPlaceList(page)
                // console.log("距顶部" + scrollTop + "可视区高度" + windowHeight + "滚动条总高度" + scrollHeight);
            }
        },
        // 点击行业下分类控制地图和列表展示
        industryImg(item1, index) {
            this.gridList.map(item => {
                item.flag1 = false
            })
            this.mapObj.dept_id = ''
            this.sonPlaceList = []
            this.placeList.map(item => {
                if (item1.cate_id == item.cate_id) {
                    item1.flag = !item1.flag
                    if (item.flag == true) {
                        this.mapObj.cate_id = item.cate_id
                        this.placeObj.cate_id = item.cate_id
                        this.map.centerAndZoom(new T.LngLat(119.0146777948411, 32.041969538363645),
                            11);
                        this.getMapPoints(this.color[index])
                    } else {
                        this.placeObj.cate_id = ''
                        this.mapObj.cate_id = ''
                        if (this.mapObj.keywords) {
                            this.mapObj.level = ''
                            this.map.centerAndZoom(new T.LngLat(119.0146777948411,
                                32.041969538363645), 11);
                            this.getMapPoints()
                        } else {
                            this.mapObj.level = 1
                            this.map.centerAndZoom(new T.LngLat(119.0146777948411,
                                32.041969538363645), 11);
                            this.getMapPoints()
                        }
                    }
                } else {
                    item.flag = false
                }
            })
            this.placeObj.page = 1
            this.getSonPlaceList(this.placeObj.page)
        },
        // 点击九下下分类控制地图和列表展示
        industryNineImg(item1, index) {
            this.isPlace9 = false
            this.nineSmallList[index].flag1 = !this.nineSmallList[index].flag1
            this.mapObj.dept_id = ''
            this.sonPlaceList = []
            this.nineSmallList.map(item => {
                if (item1.cate_id == item.cate_id) {
                    item1.flag = !item1.flag
                    if (item.flag == true) {
                        this.second_cate_id_arr.push(item.cate_id)
                        this.mapObj.second_cate_id = this.second_cate_id_arr.join(',')
                        this.placeObj.second_cate_id = this.second_cate_id_arr.join(',')
                        this.map.centerAndZoom(new T.LngLat(119.0146777948411, 32.041969538363645),
                            11);
                        this.getMapPoints(this.color1[index])
                    } else {
                        let ind = this.second_cate_id_arr.indexOf(item.cate_id)
                        this.second_cate_id_arr.splice(ind, 1)
                        if (this.second_cate_id_arr.length == 0) {
                            this.placeObj.second_cate_id = ''
                            this.mapObj.second_cate_id = ''
                            if (this.mapObj.keywords) {
                                this.mapObj.level = ''
                                this.map.centerAndZoom(new T.LngLat(119.0146777948411,
                                    32.041969538363645), 11);
                                this.getMapPoints()
                            } else {
                                this.mapObj.level = 1
                                this.map.centerAndZoom(new T.LngLat(119.0146777948411,
                                    32.041969538363645), 11);
                                this.getMapPoints()
                            }
                        } else {
                            this.mapObj.second_cate_id = this.second_cate_id_arr.join(',')
                            this.placeObj.second_cate_id = this.second_cate_id_arr.join(',')
                            this.getMapPoints(this.color1[index])
                        }
                    }
                }
            })
            this.placeObj.page = 1
            this.getSonPlaceList(this.placeObj.page)
        },
        // 选择手机地图app跳转到当前位置
        goMap() {
            wx.openLocation({
                latitude: parseFloat(this.detail.latitude), // 纬度，浮点数，范围为90 ~ -90
                longitude: parseFloat(this.detail.longitude), // 经度，浮点数，范围为180 ~ -180。
                name: this.detail.place_name, // 位置名
                address: this.detail.address, // 地址详情说明
                scale: 28, // 地图缩放级别,整型值,范围从1~28。默认为最大
                infoUrl: '' // 在查看位置界面底部显示的超链接,可点击跳转
            });
        },
        //绘制点工具函数
        drawPoints(j) {
            //根据级别进行绘制
            let bssw = this.map.getBounds().getSouthWest();
            let bsne = this.map.getBounds().getNorthEast();
            let zoom = j
            let items = this.firstPointData['map_level_' + zoom]
            //根据级别进行绘制
            for (let i = 0; i < items.length; i++) {
                let loc = items[i].location
                let element = items[i]
                if (loc) {
                    if (bssw.lat < loc[1] && bssw.lng < loc[0] && bsne.lat > loc[1] && bsne.lng > loc[0]) {
                        let index = this['mapPointsArr' + zoom].findIndex(item => item == items[i].id)
                        if (index == -1) {
                            this['mapPointsArr' + zoom].push(items.id)
                            var icon = new T.Icon({
                                iconUrl: element.icon_map,
                                id: element.id,
                                title: element.place_name,
                                iconSize: new T.Point(20, 20),
                                iconAnchor: new T.Point(10, 25)
                            });
                            var label
                            var point = new T.LngLat(element.location[0], element.location[1]);

                            label = new T.Label({
                                text: "<span class='ub-tdtlabelsl'>" + element
                                    .place_name +
                                    "</span>",
                                position: point,
                                id: element.id,
                                title: element.place_name,
                                offset: new T.Point(-16, 15)
                            })

                            var marker = new T.Marker(point, {
                                icon: icon,
                                label: label
                            }); // 创建标注
                            marker.addEventListener("click", (e) => {
                                let id = e.target.options.icon.options.id
                                this.getPointDetail(id)
                            });
                            label.addEventListener("click", (e) => {
                                let id = e.target.options.id
                                this.getPointDetail(id)
                            });
                            this['mapPointsMarkers' + zoom].push(marker)
                            this['mapPointsLabels' + zoom].push(label)
                            this.map.addOverLay(marker)
                            this.map.addOverLay(label)
                        }
                    }
                }
            }

        },
        drawPoints1(zoom) {
            //根据级别进行绘制
            let bssw = this.map.getBounds().getSouthWest();
            let bsne = this.map.getBounds().getNorthEast();
            for (var i = 0; i < this.firstPointData.length; i++) {
                let loc = this.firstPointData[i].location
                if (loc) {
                    if (bssw.lat < loc[1] && bssw.lng < loc[0] && bsne.lat > loc[1] && bsne.lng > loc[0]) {
                        let index = this.arrayObj.findIndex(item => item == this.firstPointData[i].id)
                        if (index == -1) {
                            this.arrayObj.push(this.firstPointData[i].id)
                            var icon = new T.Icon({
                                iconUrl: this.firstPointData[i].icon_map,
                                id: this.firstPointData[i].id,
                                title: this.firstPointData[i].place_name,
                                iconSize: new T.Point(20, 20),
                                iconAnchor: new T.Point(10, 25)
                            });
                            var label
                            var point = new T.LngLat(this.firstPointData[i].location[0], this.firstPointData[
                                    i]
                                .location[1]);

                            label = new T.Label({
                                text: "<span class='ub-tdtlabelsl'>" + this.firstPointData[i]
                                    .place_name +
                                    "</span>",
                                position: point,
                                id: this.firstPointData[i].id,
                                title: this.firstPointData[i].place_name,
                                offset: new T.Point(-16, 15)
                            })

                            var marker = new T.Marker(point, {
                                icon: icon,
                                label: label
                            }); // 创建标注
                            marker.addEventListener("click", (e) => {
                                let id = e.target.options.icon.options.id
                                this.getPointDetail(id)
                            });
                            label.addEventListener("click", (e) => {
                                let id = e.target.options.id
                                this.getPointDetail(id)
                            });
                            this.map.addOverLay(label);
                            this.map.addOverLay(marker);
                            this.arrMarks.push(marker, label)
                        }
                    }
                }
            }
        },
        // 显示位置
        showAddresss() {
            this.isManual = true
            setTimeout(() => {
                // console.log(this.detail.longitude, this.detail.latitude);
                // if (!this.mapma) {
                this.mapma = new T.Map("containerma");
                // }

                // if (this.markerma) {
                // 	this.mapma.removeOverLay(this.markerma)
                // }
                // //设置显示地图的中心点和级别
                this.map.centerAndZoom(new T.LngLat(this.detail.longitude, this.detail.latitude), 11);
                this.mapma.setMinZoom(11);
                this.mapma.setMaxZoom(18);
                // var icon = new T.Icon({
                // iconUrl: "http://admin.tangshan.127.youbo.me//upload/other/202302/WePrVzHy31YCuI56SaMQpDx7nd9mUBGo",
                // iconSize: new T.Point(20, 20),
                // iconAnchor: new T.Point(10, 25)
                // });
                // var point = new T.LngLat(this.detail.longitude, this.detail.latitude);
                // this.marker = new T.Marker(point, {
                // icon: icon,
                // });
                // this.markerma = new T.Marker(point);
                // this.mapma.addOverLay(this.markerma)
            }, 2000)
        },
        // 查看图片
        lookImg(list) {
            wx.previewImage({
                // current: 'http://admin.tangshan.youbo.me/upload/place/202211/7WBay02UiZx9mszwLJcjoEgrX5GYhPTV.jpg', // 当前显示图片的 http 链接
                urls: list // 需要预览的图片 http 链接列表
            });
        },
        // 去监控页面
        goMonitor() {
            location.href = "monitor.html"
        },
        // 点击附近监控页面
        showNearMonitor() {

            if (this.nearMonitorList.length == 0) {
                this.$message.closeAll()
                return this.$message({
                    message: '附近暂无监控',
                    type: 'info',
                    duration: 1000
                });
            }
            this.showDetail = false
            // 首先清空上一个附近监控点位
            this.removePoints(this.nearMonitorMarkers)
            this.removePoints(this.nearMonitorlabels)
            this.nearMonitorMarkers = [] //附件监控的marker
            this.nearMonitorlabels = [] //附件监控监控的Label
            // 绘制这一次的监控点位
            for (var i = 0; i < this.nearMonitorList.length; i++) {
                let element = this.nearMonitorList[i]
                var icon = new T.Icon({
                    iconUrl: "../images/monitor_icon1.png",
                    id: element.point_id,
                    title: element.name,
                    iconSize: new T.Point(20, 20),
                    iconAnchor: new T.Point(10, 25)
                });
                var label
                var point = new T.LngLat(element.location[0], element.location[1]);

                label = new T.Label({
                    text: "<span class='ub-tdtlabelsl'>" + element
                        .name +
                        "</span>",
                    position: point,
                    id: element.point_id,
                    title: element.name,
                    offset: new T.Point(-16, 15)
                })
                var marker = new T.Marker(point, {
                    icon: icon,
                    label: label
                }); // 创建标注
                marker.addEventListener("click", (e) => {
                    let id = e.target.options.icon.options.id
                    this.handleMonitorMarker(id)
                });
                label.addEventListener("click", (e) => {
                    let id = e.target.options.id
                    this.handleMonitorMarker(id)
                });
                this.map.addOverLay(label);
                this.map.addOverLay(marker);
                this.nearMonitorMarkers.push(marker)
                this.nearMonitorlabels.push(marker)
            }
        },
        //点击监控按钮获取监控详情
        handleMonitorMarker(id) {
            let showLoading = vant.Toast.loading({
                message: '加载中...',
                forbidClick: true,
            });
            ajax({
                url: formal + '/monitoring/get-monitoring-view',
                type: 'GET',
                data: {
                    id: id
                },
                success: (res) => {
                    if (showLoading) showLoading.close()
                    this.monitorDetail = res.data
                    this.type = res.data.type
                    if (!this.monitorDetail.url) {
                        this.isShowVideo = false
                        this.isLoading = false
                        this.$message.closeAll()
                        return this.$message.error("监控视频地址不存在")
                    }
                    if (this.type == 'vcp') {
                        this.isShowTYVideo = true
                        this.TYUrl = 'http://vcp.21cn.com/metaplayer/static/template/latest/player.html?appId=94f881&count=1&streamSrc=' + this.monitorDetail.url
                    } else {
                        this.isShowVideo = true
                    }
                    this.showVideo()
                },
                error: () => {
                    this.isShowVideo = false
                    this.isLoading = false
                    if (showLoading) showLoading.close()
                }
            })
        },
        callback(a, b) {
            console.log(b)
            if (this.num == 'end') {
                return
            }
            if (!this.num) {
                this.num = b
            }

            if (!this.numtimer) {
                this.numtimer = setTimeout(() => {
                    if (!this.num) {
                        this.isShowVideo = false
                        this.isLoading = false
                        this.player.destroy();
                        this.$message.closeAll()
                        this.num = 'end'
                        return this.$message.error("播放失败")
                    }
                }, 9000)
            }

        },
        cfKbs(a) {
            if (a.currentKbps) {
                if (this.numtimer) {
                    clearTimeout(this.numtimer)
                    this.numtimer = null
                }
            }
        },
        //点击详情摄像头图标显示监控
        showVideo() {
            if (this.numtimer) {
                clearTimeout(this.numtimer)
                this.numtimer = null
            }
            if (this.type == 'vcp') {
                // $("#my-player").hide()
                // $("#my-player1").show()
                // // this.player = new WasmPlayer(null, 'my-player1')
                // this.player = new WasmPlayer(null, 'my-player1', this.callback, {
                //     cfKbs: this.cfKbs
                // })
                // // 调用播放
                // this.player.play(this.monitorDetail.url, 1)

                const player1Api = new MpIframe(document.querySelector('#TYplayer'));
                player1Api.on('isFirstFrame', () => {
                    if (this.TYtimer) {
                        clearTimeout(this.TYtimer)
                        this.TYtimer = null
                    }
                    this.isShowTYVideoLoading = false
                })
                this.TYtimer = setTimeout(() => {
                    if (this.isShowTYVideoLoading) {
                        this.$message.error("监控播放异常")
                        clearTimeout(this.TYtimer)
                        this.TYtimer = null
                        this.TYUrl = ''
                        this.isShowTYVideo = false
                        this.isShowTYVideoLoading = false
                    }
                }, 5000)
                return
            }
            if (this.monitorDetail.url.indexOf("ws://") !== -1 || this.monitorDetail.url.indexOf("wss://") !== -1) {
                this.isShowVideo = true
                // this.isLoading = true
                $("#my-player").hide()
                this.player = new window.JSPlugin({
                    szId: 'my-player1', //节点id
                    szBasePath: '/static/h5player', //插件路径
                    openDebug: false,
                })
                let playURL =
                    this.monitorDetail.url
                this.player.JS_Play(playURL, {
                    playURL,
                    mode: 0 // 1为高级模式，0为普通模式
                }, 0).then(() => {
                    // 播放成功
                    this.isLoading = false
                }, e => {
                    // 播放失败
                    this.$message({
                        message: '播放失败',
                        type: 'error',
                        duration: 3000
                    });
                })
            } else if (this.monitorDetail.url.indexOf(".m3u8") !== -1) {
                $("#my-player1").hide()
                $("#my-player").show()
                this.isShowVideo = true
                this.isLoading = true
                this.player = document.getElementById("my-player");
                if (Hls.isSupported()) {
                    this.hls = new Hls();
                    this.hls.loadSource(this.monitorDetail.url);
                    this.hls.attachMedia(this.player);
                    this.hls.on(Hls.Events.MANIFEST_PARSED, () => {
                        this.player.play();
                        this.isLoading = false
                    });
                } else if (this.player.canPlayType("application/vnd.apple.mpegurl")) {
                    this.player.src = this.monitorDetail.url;
                    this.player.addEventListener("loadedmetadata", () => {
                        this.player.play();
                        this.isLoading = false
                    });
                }
            } else {
                if (flvjs.isSupported()) {
                    this.isShowVideo = true
                    // this.isLoading = true
                    $('.ub-showVideo').show()
                    this.showDetail = false
                    let videoElement = document.getElementById('my-player');
                    this.player = flvjs.createPlayer({
                        type: 'flv',
                        isLive: true,
                        url: this.monitorDetail.url, //<==自行修改
                    }, {
                        enableWorker: false, //不启用分离线程
                        enableStashBuffer: false, //关闭IO隐藏缓冲区
                        reuseRedirectedURL: true, //重用301/302重定向url，用于随后的请求，如查找、重新连接等。
                        autoCleanupSourceBuffer: true //自动清除缓存
                    });
                    this.player.attachMediaElement(videoElement);
                    this.player.load(); //加载
                    setTimeout(() => {
                        document.getElementById('my-player').onplay = () => {
                            this.isLoading = false
                        };
                    }, 8000)
                } else {
                    alert("ios暂不支持此格式视频播放")
                    this.showDetail = false
                }
            }


        },
        // 关闭监控
        closeVodeo() {
            if (this.numtimer) {
                clearTimeout(this.numtimer)
                this.numtimer = null
            }
            this.isShowVideo = false
            this.isLoading = false
            $('.ub-showVideo').hide()
            if (this.type == 'vcp') {
                if (this.TYtimer) {
                    clearTimeout(this.numtimer)
                    this.TYtimer = null
                }
                this.TYUrl = ''
                this.isShowTYVideo = false
                this.isShowTYVideoLoading = false
                return
            }
            if (this.monitorDetail.url.indexOf("ws://") !== -1 || this.monitorDetail.url.indexOf("wss://") !== -1) {
                this.player.JS_Stop()
            } else if (this.monitorDetail.url.indexOf(".m3u8") !== -1) {


                $('#video1').children('#my-player').remove()
                $('#video1').append('<video id="my-player" style="width: 100%;" preload="auto" muted autoplay controls style="border: 1px solid red;">< source src = "" ></video>')
                this.hls.destroy();
            } else {
                this.player.destroy()
            }

        },
        //地图移除点工具函数
        removePoints(array) {
            array.forEach(item => {
                this.map.removeOverLay(item)
            })
        },
        // 地图添加点工具函数
        addPoints(array) {
            array.forEach(item => {
                this.map.addOverLay(item)
            })
        },
        // 检查
        goInspectionDetails(id, num) {
            location.href = "./inspectionDetails.html?id=" + id + '&type=1';
            sessionStorage.setItem('numx', num);
        }

    },
})